<?php

    function t($s) {
        return Yii::t('longfinance', $s);
    }

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
    Yii::setPathOfAlias('bootstrap', dirname(__FILE__) . '/../extensions/bootstrap');
    Yii::setPathOfAlias('editable', dirname(__FILE__) . '/../extensions/x-editable');
    Yii::setPathOfAlias('chartjs', dirname(__FILE__) . '/../extensions/yii-chartjs');

//set default timezone to Malaysia
    date_default_timezone_set('Asia/Kuala_Lumpur');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
    return array(
        'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
        'theme' => 'bootstrap',
        'language' => 'zh_cn',
        'name' => '龙资 - Long Finance',
        // preloading 'log' component
        'preload' => array('log'),
        // autoloading model and component classes
        'import' => array(
            'application.models.*',
            'application.components.*',
            'application.modules.user.models.*',
            'application.modules.user.components.*',
            'application.modules.srbac.controllers.SBaseController',
            'application.modules.menu.models.*',
            'application.modules.menu.components.*',
            'application.extensions.awegen.components.*',
            //'application.extensions.yiidebugtb.*',
            'ext.galleryManager.models.*',
            'application.extensions.image.Image',
            //'application.extensions.CJuiDateTimePicker.CJuiDateTimePicker',
            'editable.*',
        ),
        'modules' => array(
            // uncomment the following to enable the Gii tool

            'gii' => array(
                'class' => 'system.gii.GiiModule',
                'password' => 'admin',
                // If removed, Gii defaults to localhost only. Edit carefully to taste.
                'ipFilters' => array('127.0.0.1', '::1'),
                'generatorPaths' => array(
                    'ext.awegen',
                    'bootstrap.gii',
                ),
            ),
            'user',
            'Customer',
            // rbac configured to run with module Yii-User
            'rbac' => array(
                'tableUser' => 'users', // Table where Users are stored. RBAC Manager use it as read-only
                'columnUserid' => 'id', // The PRIMARY column of the User Table
                'columnUsername' => 'username', // used to display name and could be same as columnUserid
                'columnEmail' => 'email'   // email (only for display)
            ),
            'srbac' => array(
                'userclass' => 'User', //User表，可以自己改
                'userid' => 'id', //id 可以自己改
                'username' => 'username',
                'delimeter' => '@',
                'debug' => TRUE,
                'pageSize' => 10,
                'superUser' => 'Authorizer',
                'css' => 'srbac.css',
                'layout' => 'application.views.layouts.main',
                'notAuthorizedView' => 'srbac.views.authitem.unauthorized',
                'alwaysAllowed' => array('SiteLogin', 'SiteLogout', 'SiteIndex', 'SiteAdmin', 'SiteError', 'SiteContact', 'SiteSMS'),
                'userActions' => array('Show', 'View', 'List'),
                'listBoxNumberOfLines' => 15,
                'imagesPath' => 'srbac.images',
                'imagesPack' => 'tango',
                'iconText' => TRUE,
                'header' => 'srbac.views.authitem.header',
                'footer' => 'srbac.views.authitem.footer',
                'showHeader' => TRUE,
                'showFooter' => TRUE,
                'alwaysAllowedPath' => 'srbac.components',
            ),
            'menu',
        ),
        // application components
        'components' => array(
            'mainsms' => array(
                'class' => 'ext.mainsms.MainSms',
                //'projectName' => 'OneWaySMS',
                'apiusername' => 'APIBJE7PIMW3S',
                'apipassword' => 'APIBJE7PIMW3SBJE7P',
                // optional:
                'useSsl' => false,
                'testMode' => true,
            ),
            'chartjs' => array('class' => 'chartjs.components.ChartJs'),
            'image' => array(
                'class' => 'application.extensions.image.CImageComponent',
                // GD or ImageMagick
                'driver' => 'GD',
            // ImageMagick setup path
            //'params' => array('directory' => 'D:/Program Files/ImageMagick-6.4.8-Q16'),
            ),
            'bootstrap' => array(
                'class' => 'bootstrap.components.Bootstrap',
            ),
            'user' => array(
                // enable cookie-based authentication
                'allowAutoLogin' => true,
                'loginUrl' => array('/user/login'),
            ),
            // uncomment the following to enable URLs in path-format
            /*
              'urlManager'=>array(
              'urlFormat'=>'path',
              'rules'=>array(
              '<controller:\w+>/<id:\d+>'=>'<controller>/view',
              '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
              '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
              ),
              ),
             */
            /*
              'db'=>array(
              'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
              ),
             */
            // uncomment the following to use a MySQL database
            'db' => array(
                'connectionString' => 'mysql:host=localhost;dbname=longfinance',
                'emulatePrepare' => true,
                'username' => 'root',
                'password' => '1234',
                'charset' => 'utf8',
                'tablePrefix' => 'mylong_',
            ),
            'errorHandler' => array(
                // use 'site/error' action to display errors
                'errorAction' => 'site/error',
            ),
            'log' => array(
                'class' => 'CLogRouter',
                'routes' => array(
                    array(
                        'class' => 'CFileLogRoute',
                        'levels' => 'error, warning, trace, profile, info',
                    ),
//                    array(// configuration for the toolbar
//                        'class' => 'XWebDebugRouter',
//                        'config' => 'alignLeft, opaque, runInDebug, fixedPos, collapsed, yamlStyle',
//                        'levels' => 'error, warning, trace, profile, info',
//                        'allowedIPs' => array('127.0.0.1', '::1', '192\.168\.1[0-5]\.[0-9]{3}'),
//                    ),
                // uncomment the following to show log messages on web pages
                /*
                  array(
                  'class'=>'CWebLogRoute',
                  ),
                 */
                ),
            ),
            'authManager' => array(
                'class' => 'CDbAuthManager',
                'connectionID' => 'db',
                'defaultRoles' => array('guest'), // default Role for logged in users
                'showErrors' => true, // show eval()-errors in buisnessRules
                'itemTable' => 'auth_item', //认证项表名称
                'itemChildTable' => 'auth_item_child', //认证项父子关系
                'assignmentTable' => 'auth_assignment', //认证项赋权关系
            ),
            'metadata' => array('class' => 'Metadata'),
        ),
        // application-level parameters that can be accessed
        // using Yii::app()->params['paramName']
        'params' => array(
            // this is used in contact page
            'adminEmail' => 'babymoon2@gmail.com',
        ),
        'controllerMap' => array('gallery' => array(
                'class' => 'ext.galleryManager.GalleryController',
                'pageTitle' => 'Gallery administration',
            ),
        ),
        'preload' => array(
            'chartjs',
        ),
    );














